package com.gxa.saas.pojo;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.gxa.saas.mapper.StoreImagesMapper;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Upload {
    @JsonIgnore
    @Autowired
    StoreImagesMapper storeImagesMapper;

    private Integer id;
    private String name;
    private String address;
    private String person;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date updateTime;
    private Integer imagesNumber;

    private List<StoreImages> storeImages;


    public void setImagesNumber(){
        List<StoreImages> storeImages = storeImagesMapper.selectByName(name);
        this.imagesNumber=storeImages.size();
    }


}
